#
# SConstruct file to build the Luna shared library
#
#

import sys
import os
import platform


# we include the hidapi locally since we have made changes to the API and source
includes = ['./hidapi']
libs = ['./hidapi/linux']


# So much work just to get Windows scons working. Note you MUST execute this within a VS Studio prompt

if sys.platform == 'win32':

	# add the system PATH and INCLUDE to our environment
	path = [os.environ['PATH']]
	include = [os.environ['INCLUDE']]
	lib = [os.environ['LIB']]

	env = Environment(ENV = {'PATH':path, 'INCLUDE':include, 'LIB':lib}, CPPPATH=includes, LIBPATH=libs)

	flags = { 'CCFLAGS':'-DLUNA_DLL_EXPORTS' }
	env.MergeFlags(flags)

	# another MS requirement
	env['ENV']['TMP'] = os.environ['TMP']

else:
	path = []
	include = []
	lib = []

	env = Environment(CPPPATH=includes, LIBPATH=libs)


# rule for our Luna shared library. Luna.dll on Windows, libLuna.so on Linux

env.SharedLibrary('Luna', ['Luna_Library.cpp', './hidapi/linux/hid-libusb.c'], LIBS=['libusb-1.0'])
